/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * Casilla.java
 *
 * Created on 30/08/2011, 16:36:45
 */

package saltocaballo.entidades;

import java.awt.Color;
import java.awt.Graphics;
import java.awt.Image;

/**
 *
 * @author Pavilion
 */
public class Casilla extends javax.swing.JPanel {

    private Image imagen;
    private Color fondo;
    private boolean visitada;
    private boolean obstaculo;
    private String coordenada;
    private boolean tieneCaballo;

    public void setTieneCaballo(boolean tieneCaballo) {
        this.tieneCaballo = tieneCaballo;
    }

    public boolean tieneCaballo() {
        return tieneCaballo;
    }

    public void setCoordenada(String coordenada) {
        this.coordenada = coordenada;
    }

    public String getCoordenada() {
        return coordenada;
    }

    public void setObstaculo(boolean obstaculo) {
        this.obstaculo = obstaculo;
    }

    public boolean tieneObstaculo() {
        return obstaculo;
    }

    public void setVisitada(boolean visitada) {
        this.visitada = visitada;
    }

    public boolean fueVisitada() {
        return visitada;
    }

    public Image getImagen() {
        return imagen;
    }

    public void setImagen(Image imagen) {
        this.imagen = imagen;
    }

    /** Creates new form Casilla */
    public Casilla() {
        initComponents();
    }
    
    public void setColor(Color c){
        fondo = c;
    }

    @Override
    public void paint(Graphics g) {
        g.drawImage(imagen, 0, 0, getWidth(), getHeight(),this);
        setBackground(fondo);
        setOpaque(false);
        super.paint(g);
    }


    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        setBackground(new java.awt.Color(255, 255, 255));

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 400, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 300, Short.MAX_VALUE)
        );
    }// </editor-fold>//GEN-END:initComponents


    // Variables declaration - do not modify//GEN-BEGIN:variables
    // End of variables declaration//GEN-END:variables

}
